/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86184
 * Date: 2023-02-03
 * Time: 13:42
 */
class Student{
    private String name;  //只能在当前类中进行修改
    private int age;

    String name1;//默认时default权限：默认权限

    public String getName() {   //以下4个为对外的接口
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}

public class encapsulation {
    public static void main(String[] args) {
        Student student1=new Student();
        student1.setName("zhou");
        student1.setAge(18);

        System.out.println(student1.getName());
        System.out.println(student1.getAge());
    }
}
